<template>
  <e-table
    ref="eTable"
    :tableData="tableData"
    :columns="columns"
    :loading="loading"
    :pageObj="null"
    :border="null"
    :maxHeight="400"
    @row-click="handleRowClick"
  />
</template>

<script>
import { getPersonalRank } from '@/api/monitor'
import { getMonitorTime } from '@/utils/util'

export default {
  data() {
    return {
      tableData: [],
      columns: [
        {
          label: '排名',
          formatter(row, column, cellValue, index) {
            return index + 1
          }
        },
        {
          label: '科室',
          prop: 'dutyDeptName'
        },
        {
          label: '姓名',
          prop: 'dutyUserName'
        },
        {
          label: '钱',
          prop: 'rewardMoney'
        },
        {
          label: '分',
          prop: 'rewardScroe'
        }
      ],
      loading: false
    }
  },
  mounted() {
    let param = getMonitorTime()
    this.getPersonalRank({ ...param })
  },
  methods: {
    getPersonalRank(param) {
      getPersonalRank(param).then(res => {
        console.log('个人考评排名', res.data)
        this.tableData = res.data
      })
    },
    handleRowClick(row, column, event) {
      console.log('row', row)
      this.$router.push({
        path: '/monitor/monitor-person-evalDetail',
        query: { row: JSON.stringify(row) }
      })
    }
  }
}
</script>
